package ms.pms.dao;

import mapper.MsMapper;
import ms.pms.entity.Role;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface RoleDAO extends MsMapper<Role> {

    @Select("<script>"
            + "select * from t_role where 1=1 "
            + "<if test=\"status != 0 \"> and status=#{status} </if> "
            + "<if test=\"name != null and name != '' \"> and name like '%${name}%' </if> "
            + "order by create_time desc" + "</script>")
    @ResultType(Role.class)
    List<Role> query(@Param("status") Integer status, @Param("name") String name);
}
